<?php

class Admin_View_Helper_Errors extends Zend_View_Helper_Abstract
{

    /**
     * Outputs errors using a uniform format
     * 
     * @param array $errors
     * @return string
     */
    public function Errors($errors)
    {

        if ($errors) {
            if (!is_array($errors)) {
                echo '<ul class="errors">';
                echo "<li>$errors</li>";
                echo '</ul>';
            } else {

                if (count($errors) > 0) {
                    echo '<ul class="errors">';
                    foreach ($errors AS $error) {
                        if (isset($error[0])) {
                            printf('<li>%s</li>', $error[0]);
                        }
                    }
                    echo '</ul>';
                }
            }
        }
    }

}

?>
